package com.demo.model;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

/**
 * UserDetailDemo
 *
 * @author liujin
 * @date 2020/12/9 0:54
 */
public class UserDetailDemo implements UserDetails {

    private String username;
    private String password;
    private String departName;
    private String id;
    private List<GrantedAuthority> authorities;

    public UserDetailDemo(String id, String username, String password, List<GrantedAuthority> authorities, String departName) {
        this.id = id;
        this.username = username;
        this.password = password;
        this.authorities = authorities;
        this.departName = departName;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return authorities;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public String getUsername() {
        return username;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }

    public String getDepartName() {
        return departName;
    }

    public void setDepartName(String departName) {
        this.departName = departName;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
}
